package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.ApprovalProcess;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/ApprovalProcessMapper.class */
public interface ApprovalProcessMapper {
    @Insert({"insert into approval_process (assets_id,", "approval_id, assets_type, ", "approval_opinion, ", "user_name, operating_time) ", "values (#{assetsId,jdbcType=INTEGER}, #{approvalId,jdbcType=VARCHAR}, #{assetsType,jdbcType=INTEGER}, ", "#{approvalOpinion,jdbcType=INTEGER}, #{userName,jdbcType=INTEGER},", "#{operatingTime,jdbcType=VARCHAR})"})
    int add(ApprovalProcess approvalProcess);

    @Select({"select * from approval_process"})
    @Results({@Result(column = "assets_id", property = "assetsId", jdbcType = JdbcType.INTEGER), @Result(column = "approval_id", property = "approvalId", jdbcType = JdbcType.VARCHAR), @Result(column = "assets_type", property = "assetsType", jdbcType = JdbcType.INTEGER), @Result(column = "approval_opinion", property = "approvalOpinion", jdbcType = JdbcType.INTEGER), @Result(column = "user_name", property = "userName", jdbcType = JdbcType.INTEGER), @Result(column = "operating_time", property = "operatingTime", jdbcType = JdbcType.VARCHAR)})
    List<ApprovalProcess> findAll();

    @Update({"update approval_process set assets_id = #{assetsId,jdbcType=INTEGER},", "approval_id = #{approvalId,jdbcType=VARCHAR},", "assets_type = #{assetsType,jdbcType=INTEGER},", "approval_opinion = #{approvalOpinion,jdbcType=INTEGER},", "user_name = #{userName,jdbcType=INTEGER},", "operating_time = #{operatingTime,jdbcType=VARCHAR}", "where id = #{id,jdbcType=INTEGER}"})
    int updateById(ApprovalProcess approvalProcess);

    @Select({"SELECT t1.approval_opinion,t1.operating_time,t2.name,t3.steps_id,t3.explanation  FROM `approval_process` t1 LEFT JOIN `user` t2 ON t1.`user_name` = t2.id LEFT JOIN assets_approval_steps t3  ON t1.approval_id = t3.steps_id AND  t1.assets_type = t3.steps_type WHERE t1.assets_id = #{assets_id} AND t1.assets_type = #{assets_type} "})
    @Results({@Result(column = "explanation", property = "explanation", jdbcType = JdbcType.INTEGER), @Result(column = "approval_opinion", property = "approvalOpinion", jdbcType = JdbcType.INTEGER), @Result(column = "name", property = "userName", jdbcType = JdbcType.INTEGER), @Result(column = "operating_time", property = "operatingTime", jdbcType = JdbcType.VARCHAR), @Result(column = "steps_id", property = "stepsId", jdbcType = JdbcType.VARCHAR)})
    List<ApprovalProcess> findByCondition(@Param("assets_id") String str, @Param("assets_type") String str2);

    @Insert({"INSERT INTO approval_process SELECT id AS assets_id,#{nextId} AS approval_id,#{assetsType} AS asset_type, #{approvalOpinion} AS approval_opinion, #{userName} AS user_name, #{operatingTime} AS operating_time FROM `assets_basics` WHERE build_num = #{buildNum} and section_name = #{sectionName}"})
    int insertToSelect(@Param("nextId") Integer num, @Param("assetsType") String str, @Param("approvalOpinion") String str2, @Param("userName") String str3, @Param("operatingTime") String str4, @Param("buildNum") String str5, @Param("sectionName") String str6);

    @Insert({"INSERT INTO approval_process SELECT id AS assets_id,#{nextId} AS approval_id,#{assetsType} AS asset_type, #{approvalOpinion} AS approval_opinion, #{userName} AS user_name, #{operatingTime} AS operating_time FROM `assets_hardwit` WHERE build_num = #{buildNum} and section_name = #{sectionName} "})
    int insertToSelecth(@Param("nextId") Integer num, @Param("assetsType") String str, @Param("approvalOpinion") String str2, @Param("userName") String str3, @Param("operatingTime") String str4, @Param("buildNum") String str5, @Param("sectionName") String str6);

    @Insert({"INSERT INTO approval_process SELECT id AS assets_id,#{nextId} AS approval_id,#{assetsType} AS asset_type, #{approvalOpinion} AS approval_opinion, #{userName} AS user_name, #{operatingTime} AS operating_time FROM `assets_softwit` WHERE build_num =#{buildNum} and section_name = #{sectionName}"})
    int insertToSelects(@Param("nextId") Integer num, @Param("assetsType") String str, @Param("approvalOpinion") String str2, @Param("userName") String str3, @Param("operatingTime") String str4, @Param("buildNum") String str5, @Param("sectionName") String str6);

    @Insert({"INSERT INTO approval_process SELECT id AS assets_id,#{nextId} AS approval_id,#{assetsType} AS asset_type, #{approvalOpinion} AS approval_opinion, #{userName} AS user_name, #{operatingTime} AS operating_time FROM `purchase` WHERE project_no =#{projectNo}"})
    int insertToSelectc(@Param("nextId") Integer num, @Param("assetsType") String str, @Param("approvalOpinion") String str2, @Param("userName") String str3, @Param("operatingTime") String str4, @Param("projectNo") String str5);

    @Select({"<script>select ap.* from approval_process ap <where>  <if test='assetsId != null and assetsId &gt; 0'>  and ap.assets_id = #{assetsId} </if><if test='assetsType != null and assetsType.length &gt; 0'>  and ap.assets_type like '%${assetsType}%' </if></where>ORDER BY ap.operating_time desc</script>"})
    @Results({@Result(column = "assets_id", property = "assetsId", jdbcType = JdbcType.INTEGER), @Result(column = "approval_id", property = "approvalId", jdbcType = JdbcType.VARCHAR), @Result(column = "assets_type", property = "assetsType", jdbcType = JdbcType.INTEGER), @Result(column = "approval_opinion", property = "approvalOpinion", jdbcType = JdbcType.INTEGER), @Result(column = "user_name", property = "userName", jdbcType = JdbcType.INTEGER), @Result(column = "operating_time", property = "operatingTime", jdbcType = JdbcType.VARCHAR)})
    List<ApprovalProcess> findProcess(ApprovalProcess approvalProcess);
}